///*
// * To change this template, choose Tools | Templates
// * and open the template in the editor.
// */
//package pio.action.administrador.rutas;
//
//import DBMS.DataBaseManager;
//import clases.Coordinador;
//import clases.Institucion;
//import clases.Ruta;
//import java.util.ArrayList;
//import java.util.List;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import org.apache.struts.action.Action;
//import org.apache.struts.action.ActionForm;
//import org.apache.struts.action.ActionForward;
//import org.apache.struts.action.ActionMapping;
//import org.apache.struts.actions.DispatchAction;
//
///**
// *
// * @author tamerdark
// */
//public class Modificar extends DispatchAction {
//
//    public ActionForward update(ActionMapping mapping, ActionForm form,
//            HttpServletRequest request, HttpServletResponse response)
//            throws Exception {
//        request.setAttribute("instituciones", Institucion.getAll());
//        Ruta c = (Ruta) form;
//        DataBaseManager dbms = DataBaseManager.getInstance();
//        boolean modificado = dbms.modificarRuta(c);
//        if (modificado) {
//            ArrayList<Ruta> li = dbms.consultarRuta(c);
//            if (li.size() > 0) {
//                c.cloneWith(li.get(0));
//            }
//            c.setMensaje("Ruta modificado exitosamente");
//            return mapping.findForward("success");
//        } else {
//            c.setMensaje("Problemas al modificar la ruta");
//            return mapping.findForward("failure");
//        }
//    }
//
//    public ActionForward populate(ActionMapping mapping, ActionForm form,
//            HttpServletRequest request, HttpServletResponse response)
//            throws Exception {
//        request.setAttribute("instituciones", Institucion.getAll());
//        DataBaseManager dbms = DataBaseManager.getInstance();
//        Ruta r = (Ruta) form;
//        List<Ruta> li = dbms.consultarRuta(r);
//        if (li.size() > 0) {
//            r.cloneWith(li.get(0));
//            System.out.println("dsadas " + r.getIdRuta());
//            System.out.println(r.getNombre());
//            System.out.println(r.getInstituciones().size());
//        }
//        return mapping.findForward("success");
//    }
//}
